sampler2D g_samSrcColor;
float timeraslow = 50;
float brillo;
float blur;
float umbral;
float contrast;

float4 MyShader(float2 Tex: TEXCOORD0) : COLOR0
{
	float4 Color;
	Color = tex2D(g_samSrcColor,Tex);
	Color.r = Color.r*sin(Tex.y*100)*2;
	Color.g = Color.g*cos(Tex.y*200)*2;
	Color.b = Color.b*sin(Tex.y*300)*2;
	return Color;
}
technique WierdColors
{
	pass p1
	{
		PixelShader = compile ps_2_0 MyShader();
	}
}
//---------------------------------------------------------------------------
float4 Alpha(float2 Tex: TEXCOORD0) : COLOR0
{
    float4 Color;
    Color = tex2D(g_samSrcColor,Tex.xy);
    Color.a = 1;
    return Color;
}
technique FullAlpha
{
    pass p
    {
        PixelShader = compile ps_2_0 Alpha();
    }
}
//----------------------------------------------------------------------------------
float4 ShaderAlargado(float2 Tex: TEXCOORD0) : COLOR0
{
    Tex.y = Tex.y * 0.5;  //Hace que la imagen sea mas alargada, T. Alargado
    float4 Color;
    Color = tex2D(g_samSrcColor,Tex.xy);
    return Color;
}
technique ExpandedShader
{
    pass p
    {
        PixelShader = compile ps_2_0 ShaderAlargado();
    }
}
//---------------------------------------------------------------------------------------
float4 Olas(float2 Tex: TEXCOORD0) : COLOR0
{
    Tex.y = Tex.y + (sin(Tex.x*200)*0.01); //T. Ondas... Waves
    float4 Color;
    Color = tex2D(g_samSrcColor,Tex.xy);
    return Color;
}
technique Waves
{
    pass p
    {
        PixelShader = compile ps_2_0 Olas();
    }
}
//---------------------------------------------------------------------------------------
float4 Water(float2 Tex: TEXCOORD0) : COLOR0
{
   
    Tex.y = Tex.y + (sin(timeraslow*Tex.x)*0.01);
    Tex.x = Tex.x + (cos(timeraslow*Tex.y)*0.01);
    float4 Color;
    Color = tex2D(g_samSrcColor,Tex.xy);
   
    return Color;
}
technique WaterEffect
{
    pass p
    {
        PixelShader = compile ps_2_0 Water();
    }
}

//------------------------------------------------------------------------------------------
//Dibujar en blanco y negro.
float4 BW(float2 Tex: TEXCOORD0) : COLOR0
{
   
    float4 Color;
    Color = tex2D(g_samSrcColor,Tex.xy);
    Color.rgb = (Color.r + Color.g + Color.b)/3;
   
    return Color;
}
technique BlackAndWhite
{
    pass p
    {
        PixelShader = compile ps_2_0 BW();
    }
}
//------------------------------------------------------------------------------------------
float4 ColorsChange(float2 Tex: TEXCOORD0) : COLOR0
{
   
    float4 Color;
    Color = tex2D(g_samSrcColor,Tex.xy);
    Color.r = 1-Color.r;
    Color.g = 1-Color.g;
    Color.b = 1-Color.b;
   
    return Color;
}
technique TechniqueColorChange
{
    pass p
    {
        PixelShader = compile ps_2_0 ColorsChange();
    }
}
//----------------------------------------------------------------------------------------
float4 ColorsBrillo(float2 Tex: TEXCOORD0) : COLOR0
{
   
    float4 Color;
    Color = tex2D(g_samSrcColor,Tex.xy);
    Color.r += brillo;
    Color.g += brillo;
    Color.b += brillo;
   
    return Color;
}
technique TechniqueBrillo
{
    pass p
    {
        PixelShader = compile ps_2_0 ColorsBrillo();
    }
}
//---------------------------------------------------------------------------------------
float4 Blur(float2 Tex: TEXCOORD0) : COLOR0
{
   
    float4 Color;
    
    float2 pos1 = float2(Tex.xy-blur);
    float2 pos2 = float2(Tex.x,Tex.y-blur);
    float2 pos3 = float2(Tex.x+blur,Tex.y-blur);
    float2 pos4 = float2(Tex.x-blur,Tex.y);
    float2 pos5 = float2(Tex.x+blur,Tex.y);
    float2 pos6 = float2(Tex.x-blur,Tex.y+blur);
    float2 pos7 = float2(Tex.x,Tex.y+blur);
    float2 pos8 = float2(Tex.xy+blur);
    
    Color = (tex2D(g_samSrcColor,Tex.xy)+
             tex2D(g_samSrcColor,pos1)+
             tex2D(g_samSrcColor,pos2)+
             tex2D(g_samSrcColor,pos3)+
             tex2D(g_samSrcColor,pos4)+
             tex2D(g_samSrcColor,pos5)+
             tex2D(g_samSrcColor,pos6)+
             tex2D(g_samSrcColor,pos7)+
             tex2D(g_samSrcColor,pos8))/9;
             
    return Color;
}
technique TechniqueBlur
{
    pass p
    {
        PixelShader = compile ps_2_0 Blur();
    }
}
//-----------------------------------------------------------------------------------------
float4 NightVision(float2 Tex: TEXCOORD0) : COLOR0
{
   
    float4 Color;
    Color = tex2D(g_samSrcColor,Tex.xy);
    Color.g = (Color.r + Color.g + Color.b)/3 + brillo;
    Color.rb = 0;
    return Color;
}
technique TechniqueNightVision
{
    pass p
    {
        PixelShader = compile ps_2_0 NightVision();
    }
}
//---------------------------------------------------------------------------------------
float4 Umbral(float2 Tex: TEXCOORD0) : COLOR0 //o Freshold
{
    float4 Color;
    Color = tex2D(g_samSrcColor,Tex.xy);
    if((Color.r + Color.g + Color.b)/3 > umbral)
    {
       Color.rgba = 1;
    }
    else
    {
       Color.rgba = 0;
    }
       
    return Color;
}
technique TechniqueUmbral
{
    pass p
    {
        PixelShader = compile ps_2_0 Umbral();
    }
}
//---------------------------------------------------------------------------------------
float4 Emboss(float2 Tex: TEXCOORD0) : COLOR0
{
    float4 Color;
    float c = 0.004;
    
    float2 pos1 = float2(Tex.xy-c);
    float2 pos2 = float2(Tex.x,Tex.y-c);
    float2 pos3 = float2(Tex.x+c,Tex.y-c);
    float2 pos4 = float2(Tex.x-c,Tex.y);
    float2 pos5 = float2(Tex.x+c,Tex.y);
    float2 pos6 = float2(Tex.x-c,Tex.y+c);
    float2 pos7 = float2(Tex.x,Tex.y+c);
    float2 pos8 = float2(Tex.xy+c);
    
             
     Color = ((tex2D(g_samSrcColor,pos1)*-2)+
             (tex2D(g_samSrcColor,pos2)*-1)+
             (tex2D(g_samSrcColor,pos3)*0)+
             (tex2D(g_samSrcColor,pos4)*-1)+
             (tex2D(g_samSrcColor,Tex.xy)*0)+
             (tex2D(g_samSrcColor,pos5)*1)+
             (tex2D(g_samSrcColor,pos6)*0)+
             (tex2D(g_samSrcColor,pos7)*1)+
             (tex2D(g_samSrcColor,pos8)*2));
             
    Color.rgb = (Color.r + Color.g + Color.b)/3;    
        
    return Color;
}
technique TechniqueEmboss
{
    pass p
    {
        PixelShader = compile ps_2_0 Emboss();
    }
}
//--------------------------------------------------------------------------------------
float4 Contrast(float2 Tex: TEXCOORD0) : COLOR0
{
    float4 Color;
    float brillo;
    float variacion;
    float nuevoBrillo;

    Color = tex2D(g_samSrcColor,Tex.xy);
    brillo = (Color.r + Color.g + Color.b)/3;
    variacion = brillo - 0.5;
    nuevoBrillo = (variacion * contrast )+ 0.5;
    Color *= nuevoBrillo;

    return Color;
}
technique TechniqueContrast
{
    pass p
    {
        PixelShader = compile ps_2_0 Contrast();
    }
}